﻿
Imports System.Data
Imports VSModel
Imports Cls_Common
Imports SecurityService

Partial Class FrontEnd_Control_Header
    Inherits System.Web.UI.UserControl
    Public URL As String = ""
    Dim level As String = 0
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load



        If Not Page.IsPostBack Then

            Using data As New VSEntities


                Dim _CartId As String = Session("CartId")
                'Dim p As VSModel.CalculateSumPriceByCartID_Result = data.CalculateSumPriceByCartID(_CartId).FirstOrDefault
                'If Not p Is Nothing AndAlso Not p.sumPrice Is Nothing Then
                '    lblSumOfMoney.Text = CType(p.sumPrice, Double).ToString("#,##0.#0") & " đ"
                'End If
                lblNumberItem.Text = (From q In data.ShoppingCarts Where q.CartId = _CartId Select q).Count


                'Dim p = (From h In data.StoreTypes Where h.StoreID = ddlStore.SelectedValue Select h.RootCateId).Distinct.ToArray
                'Dim query = (From q In Data.Categories Where q.ParentId = 0 Order By q.Sort Ascending Select q).ToList
                ''ddlType.DataValueField = "CatId"
                ''ddlType.DataTextField = "Title"
                ''If Not query Is Nothing Then
                ''    For i As Integer = 0 To query.Count - 1
                ''        ddlType.Items.Add(New ListItem(query.Item(i).Title, query.Item(i).CatId))
                ''        RecursiveFillTree(query, query.Item(i).CatId)
                ''    Next
                ''End If
                'With rptMenu
                '    .DataSource = query
                '    .DataBind()
                'End With

            End Using
        End If


    End Sub
    'Protected Sub rptMenu_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptMenu.ItemDataBound


    '    Dim row As VSModel.Category = CType(e.Item.DataItem, VSModel.Category)



    '    Dim hplTitle As HyperLink = CType(e.Item.FindControl("hplTitle"), HyperLink)
    '    hplTitle.NavigateUrl = MainDomain & "san-pham/" & row.QueryString & "-" & row.CatId.ToString & ".html"
    '    hplTitle.Text = row.Title.ToString
    '    hplTitle.ToolTip = row.CatId.ToString



    ' End Sub


    Protected Sub btnSearh_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lbtSearch.Click
        'Response.Redirect(MainDomain & "tim-kiem.html?s=" & txtSearch.Text & "&c=" & hidCate.Value)
        Response.Redirect(MainDomain & "tim-kiem-san-pham" & ".html?SearchName=" & txtSearch.Text)
    End Sub

End Class
